<template>
  <el-dialog
    title="备案登记"
    :visible.sync="dialogVisible"
    width="70%"
    :close-on-click-modal='false'
    @close='dialogVisible = false'
    >
    <el-form :model="form" label-width="80px">
        <div style="width:55%;display:flex;">
            <div>
                <el-form-item label="企业名称">
                    <el-input v-model="form.企业名称"></el-input>
                </el-form-item>
                <el-form-item label="地址">
                    <el-input v-model="form.地址"></el-input>
                </el-form-item>
                <el-form-item label="邮编">
                    <el-input v-model="form.邮编"></el-input>
                </el-form-item>
            </div>
            <div>
                <el-form-item label="所处行业">
                    <el-input v-model="form.所处行业"></el-input>
                </el-form-item>
                <el-form-item label="企业荣誉">
                    <el-checkbox-group v-model="form.企业荣誉">
                        <el-checkbox label="省或市质量奖获奖企业"></el-checkbox>
                        <el-checkbox label="山东名牌"></el-checkbox>
                        <el-checkbox label="优质基地龙头企业"></el-checkbox>
                    </el-checkbox-group>
                </el-form-item>
            </div>
        </div>
        <div style="display:flex;">
            <div style="width:30%;">
                <p style="padding:20px;font-size: 16px;font-weight: 600;">企业联系人</p>
                <el-form-item label="姓名">
                    <el-input v-model="form.企业联系人.姓名"></el-input>
                </el-form-item>
                <el-form-item label="部门">
                    <el-input v-model="form.企业联系人.部门"></el-input>
                </el-form-item>
                <el-form-item label="职务">
                    <el-input v-model="form.企业联系人.职务"></el-input>
                </el-form-item>
                <el-form-item label="电话">
                    <el-input v-model="form.企业联系人.电话"></el-input>
                </el-form-item>
                <el-form-item label="企业邮箱">
                    <el-input v-model="form.企业联系人.企业邮箱"></el-input>
                </el-form-item>
            </div>
            <div style="width:60%;">
                <p style="padding:20px;font-size: 16px;font-weight: 600;">学员信息</p>
                <div  style="display:flex;">
                    <div style="width:50%;">
                        <el-form-item label="姓名">
                            <el-input v-model="form.学员信息.姓名"></el-input>
                        </el-form-item>
                        <el-form-item label="性别">
                            <el-input v-model="form.学员信息.性别"></el-input>
                        </el-form-item>
                        <el-form-item label="出生年月">
                            <el-input v-model="form.学员信息.出生年月"></el-input>
                        </el-form-item>
                        <el-form-item label="民族">
                            <el-input v-model="form.学员信息.民族"></el-input>
                        </el-form-item>
                        <el-form-item label="手机号">
                            <el-input v-model="form.学员信息.手机号"></el-input>
                        </el-form-item>
                    </div>
                    <div style="width:50%;">
                        
                        <el-form-item label="部门">
                            <el-input v-model="form.学员信息.部门"></el-input>
                        </el-form-item>
                        <el-form-item label="职务">
                            <el-input v-model="form.学员信息.职务"></el-input>
                        </el-form-item>
                        <el-form-item label="学历">
                            <el-input v-model="form.学员信息.学历"></el-input>
                        </el-form-item>
                        <el-form-item label="个人邮箱">
                            <el-input v-model="form.学员信息.个人邮箱"></el-input>
                        </el-form-item>
                    </div>
                </div>
            </div>
        </div>
    </el-form>
    <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="confirm">确 定</el-button>
    </span>
    </el-dialog>
</template>

<script>
import {updateApply} from '@/api/admin.js'
import {
  getapplyid,
} from "@/utils/auth";
export default {
    data() {
        return {
            dialogVisible:false,
            form:{
                企业名称:'',
                地址:'',
                邮编:'',
                所处行业:'',
                企业荣誉:[],
                企业联系人:{
                    姓名:'',
                    部门:'',
                    职务:'',
                    电话:'',
                    企业邮箱:'',
                },
                学员信息:{
                    姓名:'',
                    性别:'',
                    出生年月:'',
                    民族:'',
                    手机号:'',
                    部门:'',
                    职务:'',
                    学历:"",
                    个人邮箱:'',
                },
            },
        }
    },
    methods: {
        handleClose(){
            this.dialogVisible=false
            this.form={
                企业名称:'',
                地址:'',
                邮编:'',
                所处行业:'',
                企业荣誉:[],
                企业联系人:{
                    姓名:'',
                    部门:'',
                    职务:'',
                    电话:'',
                    企业邮箱:'',
                },
                学员信息:{
                    姓名:'',
                    性别:'',
                    出生年月:'',
                    民族:'',
                    手机号:'',
                    部门:'',
                    职务:'',
                    学历:"",
                    个人邮箱:'',
                },
            }
        },
        open(data){
            this.dialogVisible=true
            console.log(data);
            if(Object.keys(data).length!=0){
                this.form=data
            }
        },
        confirm(){
            // console.log(this.form,'2222');
            // return
            updateApply({applyid:getapplyid(),badjb:JSON.stringify(this.form)}).then(res=>{
                if(res.code==200){
                    this.$message.success(res.msg)
                    this.handleClose()
                    this.$emit('seachLeng')
                }else{
                    this.$message.error(res.msg)
                }
            })
        }
    },
}
</script>

<style lang="scss" scoped>
a{
    
    
}
</style>